<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ include file="/WEB-INF/component/commonTagLib.jsp" %>
<!DOCTYPE html>
<html>
<head>
<%@ include file="/WEB-INF/component/commonCSS.jsp" %>

<title>Insert title here</title>
</head>
<body class="skin-blue-light sidebar-mini fixed skin-blue-light-frame">
    <section class="content-header">
        <h1>企业资质新增</h1>
        <ol class="breadcrumb">
            <li><a href="${ctx}/home.jsp"><i class="fa fa-home"></i>首页</a></li>
            <li class="active"><a href="#">企业库</a></li>
            <li class="active"><a href="#">企业库资质管理</a></li>
            <li class="active"><a href="#">企业资质新增</a></li>
        </ol>
    </section>
    
    <section class="content">
        <div class=" box box-success">
            <div class="box-header">
            <form role="form" class="form-horizontal" id="FormSubmit" action="${ctx}/stdCompprofile/toStdCompprofileAdd.html" method="post">
            	<input type="hidden" name="compId" id="compId" value="${compId }">
                 <div class="box-body"> 
                    <div class="form-group form-group-xs">
                        <label class="col-sm-2 text-right"><span class="required">*</span>企业资质编码：</label>
                        <div class="col-sm-4 text-left">
                            <input class="form-control" placeholder="企业编码" type="text" name="profileCode" id="profileCode" maxlength="50" value="" >
                        </div>
                        <label class="col-sm-2 text-right"><span class="required">*</span>企业资质名称：</label>
                        <div class="col-sm-4 text-left">
                            <input class=" form-control" placeholder="企业名称" name="profileName" id="profileName" type="text" maxlength="256" value="">
                        </div>
                    </div>
                    <div class="form-group form-group-xs">
                        <label class="col-sm-2 text-right"><span class="required">*</span>企业资质类型：</label>
                        <div class="col-sm-4 text-left">
                            <input class="form-control" placeholder="企业名称" type="text" name="profileType" id="profileType" maxlength="50" value="" >
                        </div>
                    </div>
                    <div class="form-group form-group-xs">
                        <label class="col-sm-2 text-right"><span class="required">*</span>企业资质有效期始：</label>
                        <div class="col-sm-4 text-left">
                             <input class=" form-control" placeholder="企业资质有效期始" name="profileStarttime" id="profileStarttime" type="text" maxlength="128" value=""readonly="readonly" data-provide="datepicker" data-date-fmt="yyyy-MM-dd" placeholder="yyyy-MM-dd">
                        </div>
                        <label class="col-sm-2 text-right"><span class="required">*</span>企业资质有效期止：</label>
                        <div class="col-sm-4 text-left">
                             <input class=" form-control" placeholder="企业资质有效期止" name="profileEndtime" id="profileEndtime" type="text" maxlength="128" value=""readonly="readonly" data-provide="datepicker" data-date-fmt="yyyy-MM-dd" placeholder="yyyy-MM-dd">
                        </div>
                    </div>
                    <div class="form-group form-group-xs">
                        <label for="acctApprovalPicDir" class="col-sm-2 text-right"><span class="required">*</span>资质图片地址：</label>
                         <div style="width:0px;height:0px;overflow:hidden;">
                                    <input id="acctApprovalPicDir" name="licence" type="file" style="display:inline-block;" />
                                </div>
                                <a href="javascript:selectImg();" style="display:inline-block;">上传</a>
                                <a href="javascript:showImg('${bankAcctInfo.acctApprovalPicDir}');" style="display:inline-block;">查看</a>
                    </div>
                </div> 
                 <div class="box-footer text-center">
                    <button type="button" onclick="save();" class="btn btn-success btn-sm">保 &nbsp; 存</button>
                    <button type="button" onclick="back();" class="btn btn-danger btn-sm">返 &nbsp; 回</button>
                </div>
            </form>
          </div>
        </div>
    </section>
<%@ include file="/WEB-INF/component/commonJS.jsp" %>
    <script src="${ctx}/lib/plugins/daterangepicker/moment.js"></script>
    <script src="${ctx}/lib/plugins/daterangepicker/daterangepicker.js"></script>
    <script type="text/javascript">
    function save(){
    	if(!validateBase()){
    		return;
    	}
    	$.HN.message.confirm('确定要保存吗？', '', '').on(function (e) {
            if (e) {
          	  $("#FormSubmit").ajaxSubmit({
          		  dataType : "json",
        			  timeout: 10000,
          		  success: function(result,statusText) {
              		if(result.success){
      	     			$.HN.message.alert('保存成功！', '提示信息', 'success');
      	     			
              		}else{
              			$.HN.message.alert('保存失败！', '提示信息', 'success');
              		}
          		  }
    	   	  });
          	  } 
  	  });
    }
    function selectImg() {
    	$('#acctApprovalPicDir').click();
    }
    function back(){
    	window.location.href="${ctx}/stdCompprofile/toStdCompprofileList.html";
    }
    
	function validateBase() {
 		var profileCode = $.trim($("#profileCode").val());
		if (profileCode == null || profileCode == "") {
			$.HN.message.alert("请输入企业资质编码！", "消息", "warn");
			return false;
		} else if (!/^[a-zA-Z0-9_]+$/.test(profileCode)) {
			$.HN.message.alert("企业资质编码只能由字母数字下划线组成！", "消息", "warn");
			return false;
		}
		$("#profileCode").val(profileCode);

		var profileName = $.trim($("#profileName").val());
		if (profileName == null || profileName == "") {
			$.HN.message.alert("请输入企业资质名称！", "消息", "warn");
			return false;
		}
		$("#profileName").val(profileName);
		
		var profileType = $.trim($("#profileType").val());
		if (profileType == null || profileType == "") {
			$.HN.message.alert("请选择企业资质类型！", "消息", "warn");
			return false;
		}
		$("#profileType").val(profileType);

		var profileStarttime = $.trim($("#profileStarttime").val());
		if (profileStarttime == null || profileStarttime == "") {
			$.HN.message.alert("请选择企业资质有效期始！", "消息", "warn");
			return false;
		}
		$("#profileStarttime").val(profileStarttime);
		

		
		var profileEndtime = $.trim($("#profileEndtime").val());
		if (profileEndtime == null || profileEndtime == "") {
			$.HN.message.alert("请选择企业资质有效期止！", "消息", "warn");
			return false;
		} 
		$("#profileEndtime").val(profileEndtime);
		
		return true;
		
	}
    </script>
</body>
</html>